package dao.faculty;

import java.util.List;

import util.paramvo.SearchParamVO;
import vo.FacultyVO;

import com.ibatis.sqlmap.client.SqlMapClient;

public class FacultyDAOImpl implements FacultyDAO{

	private SqlMapClient sqlMapClient;

	public void setSqlMapClient(SqlMapClient sqlMapClient) {
		this.sqlMapClient = sqlMapClient;
	}

	@Override
	public List<FacultyVO> getSearchedFacultyByWord(SearchParamVO search)throws Exception {
		return sqlMapClient.queryForList("faculty.getSearchedFacultyByWord", search);
	}

	@Override
	public int countSearchedFacultyByWord(List<String> search) throws Exception {
		return (Integer) sqlMapClient.queryForObject("faculty.countSearchedFacultyByWord", search);
	}

	@Override
	public void registerFaculty(String faculty_name) throws Exception {
		sqlMapClient.insert("faculty.registerFaculty", faculty_name);
	}

	@Override
	public void updateFaculty(FacultyVO param) throws Exception {
		sqlMapClient.update("faculty.updateFaculty", param);
	}

	@Override
	public void deleteFaculty(int faculty_no) throws Exception {
		sqlMapClient.update("faculty.deleteFaculty", faculty_no);
	}
}
